package com.shop.controller;

import com.shop.entity.BulkGoodsDetail;
import com.shop.entity.BulkMerchant;
import com.shop.model.PageParam;
import com.shop.model.vo.Rsp;
import com.shop.service.SupplierOrderService;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RestController
@AllArgsConstructor
public class SupplierOrderController {
    private final SupplierOrderService orderService;

    @PostMapping("searchSomeOrderPage")
    public Rsp searchSomeOrderPage(@RequestHeader("supplierId") Integer id, @RequestBody PageParam<BulkMerchant> pageParam) {
        return orderService.searchSomeOrderPage(id, pageParam);
    }

    @PostMapping("searchSomeOrderDetailPage")
    public Rsp searchSomeOrderDetailPage(@RequestBody PageParam<BulkGoodsDetail> pageParam) {
        return orderService.searchSomeOrderDetailPage(pageParam);
    }

    @PostMapping("outWarehouse")
    public Rsp outWarehouse(@RequestBody BulkMerchant bulkMerchant) {
        return orderService.outWarehouse(bulkMerchant);
    }


    @PostMapping("addOrder")
    public Rsp addOrder(@RequestHeader("userId") Integer userId, @RequestBody BulkMerchant bulkMerchant) {
        return orderService.addOrder(userId, bulkMerchant);
    }


}
